GBML manual / Backgrounds

background_see_through

Marks a background as see-through, or not, so a look from screen_blend decides how much of it shows on each row. bg is a background made with background_create. With no blend look on, a marked background looks just the way it did. Does nothing for nothing, or for a background that is gone.

Works differently on Game Boy - The Game Boy marks the picture as see-through; screen_blend then fades it toward the shade of its color 0 in bands of 18 rows or more (at most 8); the letters share the picture's shades, so they fade with it.

Works differently on Game Boy Color - The Game Boy Color marks the picture as see-through; screen_blend then fades the whole picture toward its backdrop color by the average of the look, because it cannot change all the colors on each row.

Sega Genesis: not available

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

background_see_through(bg, on)

Arguments

NameType
bgbackground
onbool

Returns

Nothing.

Description

Marks a background as see-through, or takes the mark off again. A marked background is drawn so that you can see what is behind it, and screen_blend decides how much of it shows on each row. It is how a background becomes a mist that thins out toward the floor, a dark sheet with a clear middle, or a ghost.

A real capture, two pictures of the same pine forest at dusk with a striped lighthouse, with a sheet of near-black over it - the first is nothing but black, because the sheet is solid; in the second the sheet is marked see-through and a BLEND_VIGNETTE look is on, so the forest shows through, dark at the top and the bottom and clear in the middleA real capture, two pictures of the same pine forest at dusk with a striped lighthouse, with a sheet of near-black over it - the first is nothing but black, because the sheet is solid; in the second the sheet is marked see-through and a BLEND_VIGNETTE look is on, so the forest shows through, dark at the top and the bottom and clear in the middle
A real capture, two pictures of the same pine forest at dusk with a striped lighthouse, with a sheet of near-black over it - the first is nothing but black, because the sheet is solid; in the second the sheet is marked see-through and a BLEND_VIGNETTE look is on, so the forest shows through, dark at the top and the bottom and clear in the middle

A background that is one flat near-black color, in front of the forest. Left: not marked, so it is solid and hides everything. Right: marked, with BLEND_VIGNETTE on. Real pictures from a Game Boy Advance ROM.

You give it two things:

On its own it changes nothing you can see

A marked background looks exactly the way it did until a blend look is on. The mark only says "this one may be see-through". It is screen_blend that decides how much of it shows, row by row.

So the order does not matter: mark the background first or start the blend look first. The picture changes when both are there.

Put it in front

A see-through thing shows what is behind it, so it has to be in front. A background starts at the very back, so bring a sheet of mist forward with background_priority (0 is the front).

What it costs

Nothing to run, and no slot. It only sets a mark on the background, which the console reads when it draws. The mark stays until you change it or destroy the background.

Example

sheet = background_create(0, 0, ts_doc_dungeon);
background_priority(sheet, 0);
background_see_through(sheet, true);

A background in front of everything and marked see-through. Now any screen_blend look decides how much of it shows.

sheet = background_create(0, 0, ts_doc_dungeon);

if (sheet != nothing) {
    background_priority(sheet, 0);
    background_see_through(sheet, true);
}

background_create gives back nothing when there is no room for another background, so it is safer to check before using what it gave back. To take the mark off again, call background_see_through(sheet, false): the background is solid again.

On the GBA

Costs nothing to run and holds no slot: it only sets a flag on the background, which the console reads when it draws. The console blends a marked background with whatever is behind it, using the weights screen_blend sets row by row; with no blend look and no shrouded room the weights show the background in full, so nothing changes. A marked background is a first target of the one blend the console has, the same one a shrouded room’s dark layer and a blending particle effect use, so they all follow the same look. The flag stays on the background until you change it or destroy the background. It works on a background made by background_create and no other.

See also: screen_blendsprite_see_throughbackground_createbackground_prioritybackground_blockydraw_background